/**
 * @param {string} s
 * @return {string}
 */
var reverseWords = function(s) {
  let arr = s.split(" "), result = "";
  for(let i = 0; i < arr.length; i++) {
    let temp = "";
    for(let j = arr[i].length - 1; j >= 0; j--) {
      temp += arr[i][j];
    }
    result += temp + " ";
  }
  return result.trim();
};
let s = "Let's take LeetCode contest";
console.log(reverseWords(s));
s = "God Ding";
console.log(reverseWords(s));
